<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="./Tpl/css/bootstrap.min.css">
	<style type="text/css">
		.container div.navbar-header{
			float: none;
			margin: 0 auto;
			width: 138px;
		}
		#fileInput{
			width: 150px;
			height: 50px;
			background: red url() 0 0 no-repeat;
			position: absolute;
			top: 20px;
			opacity: 0;
		}
		#fileInputshow{
			width: 150px;
			height: 50px;
			/*background: blue url() 0 0 no-repeat;*/
			float: left;
		}

		#fileBtn{
			width: 150px;
			height: 50px;
			float: left;
			margin-left: 20px;
		}
		form{
			margin: 0 auto;
			width: 320px;
			/*background: blue url() 0 0 no-repeat;*/
			padding-top: 20px;
			position: relative;
		}

	</style>
</head>
<body>
	<nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">文件管理系统</a>
        </div>
      </div>
    </nav>
    <div class="container theme-showcase" role="main">

      <!-- Main jumbotron for a primary marketing message or call to action -->
	      <div class="jumbotron">
	        <div class="col-md-12" style="height:80px;">
	        	<form action="./add.php" method="post" enctype="multipart/form-data">
	        		<div id="fileInputshow" class="btn btn-lg btn-success">选择文件</div>
	        		<input id="fileInput" type="file" name="file">
	        		<input class="btn btn-lg btn-success" id='fileBtn' type="submit" value="上传">
	        	</form>
	        </div>
				<table class="table">
			      <thead>
			        <tr>
			          <th>#</th>
			          <th>预览</th>
			          <th>文件名</th>
			          <th>大小</th>
			          <th>类型</th>
			          <th>时间</th>
			          <th>操作</th>
			        </tr>
			      </thead>
			      <tbody>
			      	<?php foreach ($paths as $k => $v) { 
			      		$arr =explode('.', $v); 
			      		$type =  end($arr);

			      		?>

			      		
			      	
			        <tr class="danger">
			          <th scope="row"><?php echo $k ?></th>
			          <td><?php if(in_array($type, ['jpg','png','gif'])){echo "<img width='30' src='".$v."'>"; } ?></td>
			          <td><?php echo iconv('GB2312', 'UTF-8', basename($v)); ?></td>
			          <td><?php echo filesize($v); ?></td>
			          <td><?php echo $type ?></td>
			          <td><?php echo filemtime($v); ?></td>
			          <td>
			          	<a class="btn btn-sm btn-danger glyphicon glyphicon-trash" href="./del.php?url=<?php echo iconv('GB2312', 'UTF-8', $v); ?>"></a>
			          	<a class="btn btn-sm btn-warning glyphicon glyphicon-download-alt" href="./down.php?url=<?php echo iconv('GB2312', 'UTF-8', $v); ?>"></a>
			          </td>
			        </tr>
			        <?php } ?>
			      </tbody>
			    </table>
	      </div>
     </div>
</body>
</html>